home *** CD-ROM | disk | FTP | other *** search
-
-
- #ifndef __VECTOR4_H_
- #define __VECTOR4_H_
- /*
- Peon - Win32 Games Programming Library
- Copyright (C) 2002-2005 Erik Yuzwa
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Erik Yuzwa
- peon AT wazooinc DOT com
- */
-
- #include "Peonstdafx.h"
-
- namespace peon
- {
- /**
- * This object is used as a 4-tuple. So far it's mainly just used for
- * lighting purposes in the @SceneLight object, but it could also perhaps
- * be used to store RGBA color information...
- *
- */
- class PEONMAIN_API Vector4
- {
- public:
- /** x component */
- float x;
-
- /** y component */
- float y;
-
- /** z component */
- float z;
-
- /** w component */
- float w;
-
- Vector4(float x_ = 0.0f, float y_ = 0.0f, float z_ = 0.0f, float w_ = 0.0f);
- ~Vector4();
-
- void set(float x_, float y_, float z_, float w_);
- float length(void);
- void normalize(void);
-
- // Static utility methods
- static float distance(const Vector4 &v1, const Vector4 &v2);
- static float dotProduct(const Vector4 &v1, const Vector4 &v2 );
- static Vector4 crossProduct(const Vector4 &v1, const Vector4 &v2);
-
- // Operators...
- Vector4 operator + (const Vector4 &other);
- Vector4 operator - (const Vector4 &other);
- Vector4 operator * (const Vector4 &other);
- Vector4 operator / (const Vector4 &other);
-
- Vector4 operator * (const float scalar);
- friend Vector4 operator * (const float scalar, const Vector4 &other);
-
- Vector4& operator = (const Vector4 &other);
- Vector4& operator += (const Vector4 &other);
- Vector4& operator -= (const Vector4 &other);
-
- Vector4 operator + (void) const;
- Vector4 operator - (void) const;
- };
-
- }
-
- #endif
-
-